package com.lottery.ruok.lottrey.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.lottery.ruok.lottrey.fragment.BaseFragment;

import java.util.ArrayList;

/**
 * Created by ASUS on 2017/11/13.
 */

public class MyFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
    private ArrayList<BaseFragment> fragments;
    private String[] titles;

    public MyFragmentStatePagerAdapter(FragmentManager fm, ArrayList<BaseFragment> fragments, String[] titles) {
        super(fm);
        this.fragments = fragments;
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int i) {
        return fragments.get(i);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}